home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20021006-20030409 / 000318_fdc@columbia.edu_Mon Feb 17 18:31:10 EST 2003.msg < prev    next >
Text File  |  2020-01-01  |  5KB  |  128 lines

  1. Article: 14114 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
  3. From: fdc@columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.protocols.kermit.misc
  5. Subject: Re: Running multiple kermit scripts on one connection
  6. Date: 17 Feb 2003 18:31:01 -0500
  7. Organization: Columbia University
  8. Lines: 111
  9. Message-ID: <b2rrbl$ks3$1@watsol.cc.columbia.edu>
  10. References: <775a2ab0.0302171458.f8f21f9@posting.google.com>
  11. NNTP-Posting-Host: watsol.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1045524663 17337 128.59.39.139 (17 Feb 2003 23:31:03 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 17 Feb 2003 23:31:03 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:14114
  16.  
  17. In article <775a2ab0.0302171458.f8f21f9@posting.google.com>,
  18. Minty <metceed@yahoo.com> wrote:
  19. : I'm trying to run multiple kermit scripts over one dial-up connection.
  20. : More specifically:
  21. : I am writing a program that will automatically send an alert. One the
  22. : the ways it sends an alert is via an sms message. I have an account
  23. : with an pstn-to-sms gateway provider. So I can dial-up this gateway
  24. : modem, and using the TAP protocol, I can send sms messages.
  25. : What I want to do is control, within my program, the 2 main aspects of
  26. : the sending process. The 'loggin on' part, and the 'sending messages
  27. : part'. I already have a kermit script that does both. I want to
  28. : seperate those to parts and call them seperately from my program. The
  29. : reason is that there could be many messages going out for the one
  30. : connection. This is decided at run-time. Another reason is so that the
  31. : program can know which alerts got sent and which didn't.
  32. : So, if for example I'm sending out 2 alerts, the steps would be as
  33. : follows:
  34. : 1-The program would run a kermit script, that opens connection from
  35. : local pc to local modem, dials the gateway modem and logs on, as per
  36. : the TAP protocol. The script would be called with the gateway provider
  37. : number as parameter.
  38. : 2-Then the program would run another kermit script, that sends
  39. : messages as per TAP protocol, with the message and sms number as
  40. : parameters, noting the exit code.
  41. : 3-It would again call the same send script with another message and
  42. : another number as parameter, again noting the exit code.
  43. : 4-It calls another scipt, that logs off the connection to the gateway
  44. : modem, and also closes connection from local pc to local modem.
  45. : Now, the problem I have noted with running multiple kermit scripts, is
  46. : that at the end of running one script, it closes the connection to the
  47. : gateway modem and also the connection from the local pc to the local
  48. : modem.
  49. : I'm using the latest kermit 95 version on a Windows 2000 machine. 
  50. : Anyone have any ideas on how I could do this? I'm sure it's only a
  51. : setting I would have to set with kermit, but I haven't found it.
  52. : One idea I did try was to manually open an instance of kermit and open
  53. : connection to local modem manually. Then call the other scripts to use
  54. : this connection, but they wouldn't use it.
  55. Ideally you'd like to be able to start Kermit and then send it messages
  56. when you want it to do something.  Unfortunately, Kermit doesn't have a
  57. way to wait for or send messages, so we have to devise a cunning plan.
  58.  
  59. One idea would be to turn your application upside down and let Kermit
  60. control the sequence of events.  For example, it could make the call, log
  61. in, and then run your application with a command-line argument that says
  62. "OK I'm logged in, now what?" and waits for your application to terminate.
  63. At this point it can dispatch based on the return code, perhaps looking in
  64. a prearranged file for instructions.  Repeat as needed.
  65.  
  66. If that's not practical, there is a little-known way of making Kermit wait
  67. for an event:
  68.  
  69.   WAIT <interval-or-clock-time> FILE CREATION <filename>
  70.  
  71. ("help wait" for details.)  This is admittedly a hack, and it would
  72. require the same thing in the other direction, because at this point
  73. Kermit is still running.
  74.  
  75. Thus your application would have to spawn Kermit asynchronously, then
  76. wait for a prearranged file to appear, which Kermit would create just
  77. before doing the WAIT.  Then your application would do whatever it does,
  78. and then when it's ready for Kermit to send a message, it would create
  79. another prearranged file, the one that Kermit is WAITing for.  Obviously,
  80. it would be handy if this file contained the message details.
  81.  
  82. So the Kermit script would go about like this:
  83.  
  84.   Make the call and log in.
  85.   If this failed, return a failure code.
  86.   If it succeeds, create the "I'm logged in" file.
  87.   While true {
  88.       Wait for message file.
  89.       If message file says "Finished" {
  90.           delete the "I'm logged in" file
  91.           Hang up and exit.
  92.       } else {
  93.           send the message.
  94.           delete (or rename) the message file
  95.       }
  96.   }
  97.  
  98. Meanwhile your application would:
  99.  
  100.   Spawn Kermit asynchronously
  101.   Wait for the "I'm logged in" file
  102.   While true {
  103.       Make sure "I'm logged in" file still exists.
  104.       Get a message to send.
  105.       Create message file.
  106.       Wait for message file to disappear.
  107.   }
  108.  
  109. Does this help?  It's not the fashiable TLA du jour but we've never been
  110. particularly concerned with fashion :-)
  111.  
  112. Obviously refinements are possible, such as queueing and various forms of
  113. bulletproofing.
  114.  
  115. - Frank
  116.